<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="ice" uri="http://www.icesoft.com/icefaces/component"%>
<f:view>
    <ice:outputHtml>
        <ice:outputHead>
            <title>JSP Page</title>
            <ice:outputStyle href="./xmlhttp/css/xp/xp.css"/>
            <link rel="stylesheet" type="text/css" href="menuStyl.css"/>
        </ice:outputHead>
        <ice:outputBody>
            <div class="container">
                <ice:form>
                    <div class="header">
                    <ul>
                        <li><ice:commandLink value="Loguj" action="login" rendered="#{!bettor.loggedIn}"/></li>
                        <li><ice:commandLink  value="Rejestracja" action="addBettor" rendered="#{!bettor.loggedInAndAdmin}">
                                <f:param value="Wprowadź swoje dane" name="tresc"/>
                        </ice:commandLink></li>

                        <li><ice:commandLink value="Wpłata" action="deposit" rendered="#{bettor.loggedInAndNotAdmin}"/></li>
                        <li><ice:commandLink value="Wypłata" action="withdrawal" rendered="#{bettor.loggedInAndNotAdmin}"/></li>
                        <li><ice:commandLink value="Historia zakładów" action="#{betslipList.action}" rendered="#{bettor.loggedInAndNotAdmin}">
                                <f:param value="n" name="pend"/>
                        </ice:commandLink></li>
                        <li><ice:commandLink value="Aktualne zakłady" action="#{betslipList.action}" rendered="#{bettor.loggedInAndNotAdmin}">
                                <f:param value="y" name="pend"/>
                        </ice:commandLink></li>

                        <li><ice:commandLink value="Dodaj użytkownika" action="addBettor" rendered="#{bettor.admin}">
                                <f:param name="tresc" value="Wprowadź dane użytkownika"/>
                        </ice:commandLink></li>
                        <li><ice:commandLink value="Dodaj dyscypline" action="addDiscipline" rendered="#{bettor.admin}"/></li>
                        <li><ice:commandLink value="Dodaj ligę" action="addLeague" rendered="#{bettor.admin}"/></li>
                        <li><ice:commandLink value="Dodaj grę" action="addGame" rendered="#{bettor.admin}"/></li>
                        <li><ice:commandLink value="Dodaj rynek" action="addMarket" rendered="#{bettor.admin}"/></li>
                        <li><ice:commandLink value="Wyloguj" action="#{bettor.wyloguj}" rendered="#{bettor.loggedIn}"/></li>
                    </ul>
                    </div>

                    <p><ice:outputText value="Witaj #{bettor.name} !" rendered="#{bettor.loggedInAndNotAdmin}">
                            <ice:effect event="mouseover" effectType="shake"/>
                        </ice:outputText><br>
                    <ice:outputText value="Stan konta: #{bettor.balance}" rendered="#{bettor.loggedInAndNotAdmin}"/></p>

                    <div class="left">
                    <ice:tree id="tree"
                              value="#{treeDemo.model}"
                              var="item"
                              hideRootNode="false"
                              hideNavigation="false"
                              imageDir="./xmlhttp/css/xp/css-images/" >
                        <ice:treeNode>
                            <f:facet name="icon">
                                <ice:panelGroup style="display: inline">
                                    <h:graphicImage value="#{item.userObject.icon}"/>
                                </ice:panelGroup>
                            </f:facet>
                            <f:facet name="content">
                                <ice:panelGroup style="display: inline">
                                    <ice:commandLink actionListener="#{treeDemo.nodeSelected}"
                                                     value="#{item.userObject.text}">
                                        <f:param value="#{item.userObject.id}" name="id"/>
                                    </ice:commandLink>
                                </ice:panelGroup>
                            </f:facet>
                        </ice:treeNode>
                    </ice:tree>
                    </div>

                    <div class="content">
                    <ice:panelGroup styleClass="backBeanChangeBody"
                                    effect="#{treeDemo.effect}">
                        <ice:panelGroup style="margin: 0; padding: 0;width:100px;">
                            <ice:panelGrid cellpadding="0" cellspacing="3" columns="4"
                                           rendered="#{treeDemo.selected}">

                                <ice:outputText value="Zdarzenie: "/>

                                <ice:commandLink value="#{treeDemo.market.odds_away}" actionListener="#{betslip.marketSelected}">
                                    <f:param value="2" name="market"/>
                                </ice:commandLink>
                                <ice:commandLink value="#{treeDemo.market.odds_draw}" rendered="#{!treeDemo.binaryGame}" actionListener="#{betslip.marketSelected}">
                                    <f:param value="x" name="market"/>
                                </ice:commandLink>
                                <ice:commandLink value="#{treeDemo.market.odds_home}" actionListener="#{betslip.marketSelected}">
                                    <f:param value="1" name="market"/>
                                </ice:commandLink>

                            </ice:panelGrid>
                        </ice:panelGroup>
                    </ice:panelGroup>

                    <ice:panelGroup styleClass="backBeanChangeBody"
                                    >
                        <ice:panelGroup style="margin: 0; padding: 0;width:350px;" rendered="#{bettor.loggedInAndNotAdmin}">
                            <ice:panelGrid cellpadding="0" cellspacing="3" columns="5"
                                           rendered="#{betslip.selected}">

                                <ice:outputText value="Wybrałeś #{betslip.stringSelection}"/>
                                <ice:outputText value="@ #{betslip.odds}"/>
                                <ice:outputText value="Kwota"/>
                                <ice:inputText value="#{betslip.stake}">
                                    <f:validateDoubleRange minimum="0.0"/>
                                </ice:inputText>
                                <ice:commandButton value="Ok" action="#{betslip.trySubmit}"/>
                            </ice:panelGrid>
                        </ice:panelGroup>
                    </ice:panelGroup>
                    </div>
                </ice:form>
                <div class="footer">
                    <ice:outputText value="Powerd by"/>
                </div>
            </div>
        </ice:outputBody>
    </ice:outputHtml>
</f:view>